function getRequest(url,reqData,async,sucHandler,errHandler,comHandler){
  $.ajax({
    type:"post",
    url:locationUrl+url,
    data:reqData,
    async:async,
    contentType:"application/json",
    success:function(data){
      sucHandler(data);
    },error:function(){
      errHandler && errHandler();
    },
    complete:function(){
      comHandler && comHandler();
    }
  })
}

function imgCodeObj(){
  var url = "/hft-web/servlet/validateCodeServlet";
  return {
    getImg:url,
    refreshImg:url+"?"+new Date().getTime(),
    verifyImg:function(imgCode,sucHandler,errHandler,comHandler){
      verifyImg(url+"?validateCode="+imgCode,sucHandler,errHandler,comHandler);
    }
  }
}

var key="181D244714EE2A1A4E1E6C344359D89D181D244714EE2A1A";
function strToHexCharCode(str) {
　　if(str === ""){
  　　return "";
  }
　　var hexCharCode = [];
　　hexCharCode.push("0x"); 
　　for(var i = 0; i < str.length; i++) {
  　　　　hexCharCode.push((str.charCodeAt(i)).toString(16));
　　}
　　return hexCharCode.join("");
}

function hexCharCodeToStr(hexCharCodeStr) {
　　var trimedStr = hexCharCodeStr.trim();
　　var rawStr = trimedStr.substr(0,2).toLowerCase() === "0x"?trimedStr.substr(2):trimedStr;
　　var len = rawStr.length;
　　if(len % 2 !== 0) {
  　　　　return "";
　　}
　　var curCharCode;
　　var resultStr = [];
　　for(var i = 0; i < len;i = i + 2) {
  　　　　curCharCode = parseInt(rawStr.substr(i, 2), 16);
  　　　　resultStr.push(String.fromCharCode(curCharCode));
　　}
　　return resultStr.join("");
}

function encryptByDESModeEBC(message){
  var message1 = strToHexCharCode(encodeURI(message));
  var keyHex = CryptoJS.enc.Hex.parse(key);
  var messageT = CryptoJS.enc.Hex.parse(message1);
  var encrypted = CryptoJS.TripleDES.encrypt(messageT, keyHex, {
    mode: CryptoJS.mode.ECB,
    padding: CryptoJS.pad.Pkcs7
  });  
  var result_value = encrypted.ciphertext.toString(CryptoJS.enc.Hex);
  return result_value;
}

function decryptByDESModeEBC(ciphertext){
  var keyHex = CryptoJS.enc.Hex.parse(key);
  var decrypted = CryptoJS.TripleDES.decrypt({
    ciphertext: CryptoJS.enc.Hex.parse(ciphertext)
  }, keyHex, {
    mode: CryptoJS.mode.ECB,
    padding: CryptoJS.pad.NoPadding
  });
  var result_value = decrypted.toString(CryptoJS.enc.Hex);
  return hexCharCodeToStr(result_value);
}
function getDecryptByDESModeEBCRes(data){
  var lastIndex = decodeURI(data).lastIndexOf('}');
    data= data.substring(0,lastIndex+1);
    data = JSON.parse(data);
    return data;
}